﻿using System.Collections.Generic;

namespace JH
{
    public static class AddRangeExtension
    {
        /// <summary>
        ///  扩展方法，用于向集合中添加多个集合,返回新的列表，引用不会指向原有集合
        /// </summary>
        public static List<T> AddRangeEm<T>(this IEnumerable<T> list, params IEnumerable<T>[] collection)
        {
            var ret = new List<T>();
            ret.AddRange(list);

            foreach (var item in collection)
            {
                if (item == null) continue;
                ret.AddRange(item);
            }

            return ret;
        }
    }
}